﻿using CADInterface;
using ReflectionStudio.Components.UserControls;
using ReflectionStudio.Core.Events;
using ReflectionStudio.Core.Helpers;
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    /// <summary>
    /// Interaction logic for SETUPABON.xaml
    /// </summary>
    public partial class CADMAPINTEX : DocumentBase
    {
        public DSTCADDB dSTCADDB;
        DataSet setDISPO = new DataSet();  
        CADMAPINTEXData m_Data;
        public CADMAPINTEX()
        {
            InitializeComponent();
            dSTCADDB = (DSTCADDB)TryFindResource("dSTCADDB");
            this.Name = "参数设定"; 
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }
        public override void SetUp(Dictionary<string, object> dicParamater)
        {
            try
            {
                using (new LongOperation(this, "读取符合条件的记录"))
                {
                    base.SetUp(dicParamater); 
                    m_Data = new CADMAPINTEXData();
                    dSTCADDB = (DSTCADDB)TryFindResource("dSTCADDB");
                }
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }
        private void btnGetCADMap_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                dSTCADDB.Clear();
                dSTCADDB.AcceptChanges();
                DataSet setresult = m_Data.ReSetData();
                dSTCADDB.Merge(setresult);
                dSTCADDB.AcceptChanges();
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }
        private void cmdLoadCADMap_Click(object sender, RoutedEventArgs e)
        { 
            DataSet setResult = m_Data.LoadSetCADMAPINTEX();
            dSTCADDB.Merge(setResult); 
            
        }
    }
}
